package com.fqgj.xjd.user.client.enums;


import java.util.ArrayList;
import java.util.List;

/**
 * Created by linchengyu on 17/3/3.
 */
public enum UserCareerEnum {
    Agriculture(1, "Agriculture",false),
    // STUDENT(2, "学生",false),
    Architecture(3, "Architecture",false),
    BiologicalAndBiomedicalSciences(4, "Biological and Biomedical Sciences",false),
    Business(5, "BUSINESS",false),
    CommunicationsAndJournalism(6, "Communications and Journalism",false),
    ComputerSciences(7, "Computer Sciences",false),
    CulinaryArtsAndPersonalServices(8, "Culinary Arts and Personal Services",false),
    Education(9, "Education",false),
    Engineering(10, "Engineering",false),
    Legal(11, "Legal",false),
    LiberalArtsAndHumanities(12, "Liberal Arts and Humanities",false),
    MechanicAndRepairTechnologies(13, "Mechanic and Repair Technologies",false),
    MedicalAndHealthProfessions(14, "Medical and Health Professions",false),
    PhysicalSciences(16, "Physical Sciences",false),
    Psychology(17, "Psychology",false),
    TransportationAndDistribution(18, "Transportation and Distribution",false),
    VisualAndPerformingArts(18, "Visual and Performing Arts",false),
    Other(15, "Other",false),
    SALARIED_FULL_TIME(201, "Salaried-Full Time",true),
    SALARIED_PART_TIME(202, "Salaried-Part Time",true),
    SELF_EMPLOYED(203, "Self-Employed",true),
    NO__WORK(204, "No-Work",true),
    BUSINESS(205, "Business",true);

    private Integer type;
    private String desc;
    /**
     * 是否显示
     */
    private boolean display;

    UserCareerEnum(Integer type, String desc, boolean display) {
        this.type = type;
        this.desc = desc;
        this.display = display;
    }

    public Integer getType() {
        return type;
    }

    public UserCareerEnum setType(Integer type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public UserCareerEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public boolean isDisplay() {
        return display;
    }

    public UserCareerEnum setDisplay(boolean display) {
        this.display = display;
        return this;
    }

    public static List<String> getDescList() {
        List<String> list = new ArrayList<>();
        for (UserCareerEnum enumObj : UserCareerEnum.values()) {
            if(enumObj.isDisplay()) {
                list.add(enumObj.getDesc());
            }
        }
        return list;
    }

    public static UserCareerEnum getEnumByType(Integer type) {
        UserCareerEnum userCareerEnum = null;
        for (UserCareerEnum enumObj : UserCareerEnum.values()) {
            if (enumObj.getType().equals(type)) {
                userCareerEnum = enumObj;
                break;
            }
        }
        return userCareerEnum;
    }

    public static UserCareerEnum getEnumByDesc(String desc) {
        UserCareerEnum userCareerEnum = null;
        for (UserCareerEnum enumObj : UserCareerEnum.values()) {
            if (enumObj.getDesc().equals(desc)) {
                userCareerEnum = enumObj;
                break;
            }
        }
        return userCareerEnum;
    }
}
